filename = 'sample.txt'
with open(filename) as f:
    f1 = f.read().replace(',',' ').replace('.',' ').replace('(',' ').replace(')',' ').replace('\n',' ').strip()
    f1 = f1.split()
#     print(f1)
    count_nums = {}
    for i in f1:
        if i in count_nums:
            count_nums[i] +=1
        else:
            count_nums[i] =1
result = sorted(count_nums.items(),reverse=True, key=lambda item:item [1])[:10]
for i in result:
    print(*i)

# 效率很差，可以再改进一下
